package com.github.codemperor.gateway.context;

import com.github.codemperor.api.base.BaseCodeEnum;
import com.github.codemperor.core.token.CurrentUserInfo;

/**
 * @description 当前线程过滤器所用到的数据
 * @Author codemperor
 * @Date 2018/9/10 下午2:38
 */
public class FilterContext {
    /**
     * 每次请求的用户信息, 用于拼装整个信息给下游服务
     */
    public static final ThreadLocal<CurrentUserInfo> currentUserInfo = new ThreadLocal<>();

    /**
     * 用于在最后filter中判断是否向下游透传请求
     */
    public static final ThreadLocal<BaseCodeEnum> endingException = new ThreadLocal<>();

    /**
     * 是否开启api过滤认证
     */
    public static final ThreadLocal<Boolean> apiFilterEnabled = new ThreadLocal<>();

    /**
     * 是否开启登陆token过滤认证
     */
    public static final ThreadLocal<Boolean> tokenFilterEnabled = new ThreadLocal<>();

    /**
     * 是否开启登陆前端系统token过滤认证
     */
    public static final ThreadLocal<Boolean> websiteTokenFilterEnabled = new ThreadLocal<>();

    /**
     * 接口所花费的时间
     */
    public static final ThreadLocal<Long> costMillis = new ThreadLocal<>();
}
